Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'JP Morgan' - 23 question(s) found - Order By Newest | ||||
Advanced level question. Frequently asked in High end product companies. Frequently asked in Google , Cognizant and Deloitte ( Based on 2 feedback ) | ||||
| ||||
Ans. 1. String Pool - When a string is created and if it exists in the pool, the reference of the existing string will be returned instead of creating a new object. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references. Example - String str1 = "String1"; String str2 = "String1"; // It doesn't create a new String and rather reuses the string literal from pool // Now both str1 and str2 pointing to same string object in pool, changing str1 will change it for str2 too 2. To Cache its Hashcode - If string is not immutable, One can change its hashcode and hence it's not fit to be cached. 3. Security - String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Making it mutable might possess threats due to interception by the other code segment. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   string   string class   immutable  immutability   advanced Asked in 39 Companies expert   frequent | ||||
Try 4 Question(s) Test | ||||
Frequently asked to fresh graduates and less experienced developers. Among the first few questions in many interviews. | ||||
| ||||
Ans. Composition - has-a relationship between objects. Inheritance - is-a relationship between classes. Composition - Composing object holds a reference to composed objects and hence relationship is loosely bound. Inheritance - Derived object carries the base class definition in itself and hence its tightly bound. Composition - Used in Dependency Injection Inheritance - Used in Runtime Polymorphism Composition - Single class objects can be composed within multiple classes. Inheritance - Single class can only inherit 1 Class. Composition - Its the relationship between objects. Inheritance - Its the relationship between classes. | ||||
Sample Code for inheritance Sample Code for composition | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java concepts   inheritance  object oriented programming (oops)  oops concepts   composition  object oriented programming (oops)  oops concepts   inheritance  object oriented programming (oops)  inheritance vs composition  object oriented programming (oops)  oops concepts Asked in 29 Companies basic   frequent | ||||
Try 5 Question(s) Test | ||||
Frequently asked at Manhattan Associates ( Based on 2 feedback ) | ||||
| ||||
Ans. Its an anonymous method without any declaration. Lambda Expression are useful to write shorthand Code and hence saves the effort of writing lengthy Code. It promotes Developer productivity, Better Readable and Reliable code. | ||||
Sample Code for lambda | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   lambda expression   architecture Asked in 58 Companies expert   frequent | ||||
Try 1 Question(s) Test | ||||
Advanced level question usually asked in High end product companies. Have been asked in Google and Amazon (Based on 1 Feedback) | ||||
| ||||
Ans. The Java runtime environment deletes objects when it determines that they are no longer being used. This process is known as garbage collection. The Java runtime environment supports a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector that scans Java dynamic memory areas for objects, marking those that are referenced. After all possible paths to objects are investigated, those objects that are not marked (i.e. are not referenced) are known to be garbage and are collected. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   garbage collection   java memory management   advanced Asked in 21 Companies intermediate   frequent | ||||
Try 4 Question(s) Test | ||||
Frequently asked question in companies using hibernate. | ||||
| ||||
Ans. 1. First level cache is enabled by default whereas Second level cache needs to be enabled explicitly. 2. First level Cache came with Hibernate 1.0 whereas Second level cache came with Hibernate 3.0. 3. First level Cache is Session specific whereas Second level cache is shared by sessions that is why First level cache is considered local and second level cache is considered global. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  hibernate   orm   hibernate cache   architecture   technical lead   first level cache vs second level cache Asked in 18 Companies Intermediate   frequent | ||||
| ||||
Ans. Java doesn't support multiple inheritance. Interfaces does't facilitate inheritance and hence implementation of multiple interfaces doesn't make multiple inheritance. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oop   oop concepts   inheritence   multiple inheritence   basic interview question Asked in 10 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
Frequently asked at HCL Technologies ( Based on 3 feedback ) | ||||
| ||||
Ans. Checked exceptions are the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions are caught during run time only and hence can't be checked. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   exceptions   checked exceptions   unchecked exceptions   exception handling   checked vs unchecked exceptions Asked in 39 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. BlockingQueue is a Queue that supports operations that wait for the queue to become non-empty when retrieving and removing an element, and wait for space to become available in the queue when adding an element. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  blockingqueue   collections   java   concurrent collections Asked in 10 Companies | ||||
Very frequently asked. Usually asked with questions related to String. Frequently asked at CTS / Cognizant | ||||
| ||||
Ans. Object that can't be changed after instantiation. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   immutable  immutability Asked in 27 Companies basic   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. The memory pool containing all the reflective data of the java virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. The Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application. The permanent generation is populated by the JVM at runtime based on classes in use by the application. In addition, Java SE library classes and methods may be stored here. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   jvm   memory management   permgen   permanent generation   advanced   architecture Asked in 9 Companies expert | ||||
| ||||
Ans. public void checkIfAnagram(String str1,String str2){ boolean anagram = true; for(char c:str1.toCharArray()){ if(!str2.contains(String.valueOf(c))){ System.out.println("Strings are Anagrams"); anagram = false; } if(anagram == true){ System.out.println("Strings are not Anagrams"); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   check if 2 strings are Anagrams Asked in 30 Companies basic   frequent | ||||
| ||||
Ans. Both are creational design patterns. Singleton is used when we would like to reuse an object if object is not supposed to hold request or thread specific information. Inversely Prototype is used in situations where we would like to reuse the object information but the request / thread may require it own data to be persisted. In short, Singleton is used in situations where we can live with single object being shared across multiple requests or threads whereas Prototype is used when we need duplicate copies of objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design pattern  singleton  prototype  creational design pattrn Asked in 7 Companies expert | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. ClassNotFoundException is checked exception whereas NoClassDefFoundError is a unchecked exception. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   exceptions   checked exceptions   unchecked exceptions   exception handling Asked in 2 Companies | ||||
Usually asked only to fresh graduates and less experienced developers. | ||||
| ||||
Ans. These are threads that normally run at a low priority and provide a basic service to a program or programs when activity on a machine is reduced. garbage collector thread is daemon thread. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   threads   multi threading   operating system   daemon thread   garbage collection Asked in 10 Companies intermediate   frequent | ||||
Try 2 Question(s) Test | ||||
| ||||
Ans. Assert works only if assertions ( -ea ) are enabled which is not required for Verify.Assert throws an exception and hence doesn't continue with the test if assert evaluates to false whereas it's not so with Verify. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  assert   junit   mockito   verify   testing   unit testing Asked in 5 Companies | ||||
Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan and TCS (Based on 2 feedback) | ||||
| ||||
Ans. http://www.buggybread.com/2014/03/java-design-pattern-singleton-interview.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   design pattern   singleton   at&t   ebay  fidelity india  united healthcare india Asked in 46 Companies intermediate   frequent | ||||
| ||||
Ans. CRUD stands for "Create, read, update and delete" are the basic functions of persistence. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  CRUD  Persistence  Database  Database Operations Asked in 3 Companies Basic   frequent | ||||
Frequently asked for Lead and Architect positions. Recently asked in many US companies. | ||||
| ||||
Ans. Anti-pattern is simply the creation of a pattern in your coding that negatively affects your code i.e the Negatives surpasses the positives. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  anti patterns  design patterns Asked in 9 Companies   frequent | ||||
Very frequently asked. | ||||
| ||||
Ans. Synchronize is used to achieve mutual exclusion i.e at one time, the segment of the code, method that has been declared synchronized should be executed by single thread only and hence the lock needs to be retrieved before executing the segment and then released. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  threads  multithreading  synchronized Asked in 5 Companies basic   frequent | ||||
Frequently asked in Accenture. | ||||
| ||||
Ans. [Open Ended Answer] | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  general question  non technical question Asked in 20 Companies   frequent | ||||
| ||||
Ans. Spring Boot is Springs convention-over-configuration solution for creating stand-alone, production-grade Spring-based Applications. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Spring Boot Asked in 7 Companies | ||||
| ||||
Ans. JSONObject jsonChildObject = (JSONObject)jsonObject.get("LanguageLevels"); for (Map.Entry in jsonChildOBject.entrySet()) { System.out.println("Key = " entry.getKey() ", Value = " entry.getValue()); } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  json  nested json Asked in 1 Companies | ||||
| ||||
Ans. TypeScript is used to Apply types to your JavaScript code, And it shows the error in IDE while writing code and make us to fix it to avoid any bug or issue before build and deployment, for example: you put //@ts-code at top of your js file, and it will show errors in file when u make common code mistakes. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||